<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="org.apache.commons.lang.StringUtils,java.util.*,com.hz.supermanage.dao.Constants,com.hz.framework.util.BusinessException"%>
<jsp:useBean id="dao" class="com.hz.supermanage.dao.OrganizationDao" />
<%
     String empId = request.getParameter("empId");

	Map emUser = new HashMap();
    try {
    	if (StringUtils.isBlank(empId)) {
            throw new BusinessException("用户标识不能为空");
        }
    	emUser = dao.getEmpHoldInfo(empId,request);
        
    }catch(Exception ex) {
        throw new BusinessException("失败", ex);
    }

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>安排新岗位</title>
<script type='text/javascript' src='${pageContext.request.contextPath}/parts/framejs/ajax/ajax.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/ajax.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/engine.js'></script>
<script src="<%=request.getContextPath()%>/parts/itemjs/supermanage/setup/Juice.js" language="JavaScript" type="text/javascript" ></script>
<script src="<%=request.getContextPath()%>/parts/itemjs/supermanage/setup/MessageMgr.js" language="JavaScript" type="text/javascript" ></script>
<link href="<%=request.getContextPath()%>/parts/CSS/base.css" rel="stylesheet" type="text/css"/>
<link href="<%=request.getContextPath()%>/parts/CSS/lb.css" rel="stylesheet" type="text/css"/>
<%@ include file="inc/action_components.jsp"  %>
<script type="text/javascript">
      //单位选择改变
    function doOrgChange() {
      var d = event.srcElement;
      if(d.value!=""){
      	clearOptions(__get("posId"));
      	loadDeptSelect(d.value);
      }else{
      	clearOptions(__get("deptId"));
      	clearOptions(__get("posId"));
      }
    }

    //部门选择改变
    function doDeptChange() {
      var d = event.srcElement;
      if(d.value!="")
      	loadPosSelect(d.value);
      else clearOptions(__get("posId"));
    }

    function loadDeptSelect($v) {
    	if($v!="")
    	loadingSelectwherevt(__get("deptId"),"HF02","and parentid = '"+$v+"'");//调用value和text不同的select筛选
    }

    function loadPosSelect($v) {
      if($v!="")
    	loadingSelectwherevt(__get("posId"),"HF03","<%=empId%>) and parentid = '"+$v+"'");//调用value和text不同的select筛选
    }

    function renderFinish() {
      var domOrg = __get("orgId");
      if (!__isEmpty(domOrg.value)) {
        loadDeptSelect(domOrg.value);
      }
      var domDept = __get("deptId");
      if (!__isEmpty(domDept.value)) {
        loadPosSelect(domDept.value);
      }
    }


    function form1_check($domForm, $errorList) {
      var dOrg = __get("orgId");
      var dDept = __get("deptId");
      var dPos = __get("posId");
      if (dOrg==null || __isEmpty(dOrg.value)) {
        $errorList.add("单位标识不能为空");
      }
      if (dDept==null || __isEmpty(dDept.value)) {
        $errorList.add("部门标识不能为空");
      }
      if(dPos==null || __isEmpty(dPos.value)) {
        $errorList.add("岗位标识不能为空");
      }
    }

</script>
</head>
<body style="overflow: hidden">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: white;">
  <tr>
    <td height="30" background="${pageContext.request.contextPath}/parts/images/tab_05.gif">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="30"><img src="${pageContext.request.contextPath}/parts/images/tab_03.gif" width="12" height="30" /></td>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="46%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><div align="center"><img src="${pageContext.request.contextPath}/parts/images/tb.gif" width="16" height="16" /></div></td>
                <td width="95%" class="STYLE1">安排新岗位：<span id=domEmpFilterDesc style='color:red'></span></td>
              </tr>
            </table></td>
            <td width="54%" align="right">
<div align="right" style="overflow: auto;">
<INPUT class="btn2" type="button" value="保  存" onclick="__post()" style='cursor:hand'>&nbsp;&nbsp;
<INPUT class="btn2" type="button" value="关闭窗口" onclick="parent.__close()" style='cursor:hand'>&nbsp;&nbsp;
</div>
			</td>
          </tr>
        </table></td>
        <td width="16"><img src="${pageContext.request.contextPath}/parts/images/tab_07.gif" width="16" height="30" /></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      		<tr>
        <td width="8" background="${pageContext.request.contextPath}/parts/images/tab_12.gif">&nbsp;</td>
        <td align="center" >
        

<form action="xml/emp_pos_add_action.jsp" name=form1 method=post>
<input type=hidden name=empId value="<%=empId%>">    
<table width=100%><tr><td class=formTableContainer>
<table width=100% cellpadding=3>
<COL ALIGN="right" width=10%>
<COL ALIGN="left" width=40%>
<COL ALIGN="right" width=10%>
<COL ALIGN="left" width=40%>
<tr><td colspan="2" align="left">&nbsp;&nbsp;用户： <%=emUser.get("personname")%></td>
    <td colspan="2" align="left">&nbsp;&nbsp;岗位类型：<input type=radio value="<%=Constants.EMP_POS_DIVIDE_INCHARGE%>" name=posType id=PosA checked><label for=PosA>分管</label>
        <input type=radio value="<%=Constants.EMP_POS_PARTTIME%>" name=posType id=PosB><label for=PosB>兼职</label></td>
</tr>
<tr><td>单位：</td><td><select name='orgId' style="width: 170px" onchange=doOrgChange()>
    			<option value="">请选择</option>
    			<c:forEach items="${value}" var="rows">
				<option value="${rows.depid}" >${rows.depname}</option>
				</c:forEach>
    			</select></td>
   	<td>部门：</td><td><span id=DomDeptSelect><select name='deptId' style="width: 170px" onchange=doDeptChange()>
   			<option value="">请选择</option>
   			</select></span>
   			</td></tr>
<tr><td>岗位：</td><td><span id=DomPosSelect><select name='posId' style="width: 170px">
			<option value="">请选择</option>
			</select></span></td>
			<td></td><td></td></tr>
</table>
</td></tr></table>
</form>


</td>
        <td width="8" background="${pageContext.request.contextPath}/parts/images/tab_15.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="35" background="${pageContext.request.contextPath}/parts/images/tab_19.gif">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="35"><img src="${pageContext.request.contextPath}/parts/images/tab_18.gif" width="12" height="35" /></td>
        <td>&nbsp;</td>
        <td width="16"><img src="${pageContext.request.contextPath}/parts/images/tab_20.gif" width="16" height="35" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>